<?php
	$statusselect='';
	if(isset($_POST['statusselect']))	$statusselect=$_POST['statusselect'];
?>
<div class="content-box"><!-- Start Content Box -->
   
    <div class="content-box-header">
        
        <h3>Video</h3>
        
        <ul class="content-box-tabs">
       
            <li><a href="#tab1" class="default-tab">Table</a></li> <!-- href must be unique and match the id of target div -->
            <li><a href="#tab2">Forms</a></li>
        </ul>
        
        <div class="clear"></div>
        
    </div> <!-- End .content-box-header -->
    
    <div class="content-box-content">
   
        <div class="tab-content default-tab" id="tab1">
<div class="qt-child-container">
    Trạng thái:
    <form action="" method="post" enctype="multipart/form-data">
        <table>
            <tr>
                <td>
                    <select id="statusselect" name="statusselect" style="float: left;width: 150px">
                        <option selected value=""></option>
                        <option  value="1">Đã xuất bản</option>
                        <option  value="0">Nháp</option>

                    </select>

                    <p style="float: left; margin-top: -2px"><input class="button" type="submit" value="Cập nhật trạng thái" style="height: 27px"/></p>
                </td>

            </tr>
        </table>
    </form>
    <?php
	if($statusselect==''){
		$sql='SELECT * FROM tbl_tintuc ORDER BY id DESC LIMIT 8';						
		}else{
    	$sql='SELECT * FROM tbl_tintuc WHERE trangthai="'.$statusselect.'" ORDER BY id DESC LIMIT 8';						
	}
			$result=mysql_query($sql);
			$num=mysql_num_rows($result);	
			if($num>0)
			{
			?>
				<table class="table table-bordered" id="post-table">
				<tr id="sort-row" data-base-url="/admin_vina/post/all/article" data-sort-type="asc">
					<th>#</th>
					<th data-model="Post" id="post_title"><a href="#">Tiêu đề</a></th>
					<th>Ảnh tiêu đề</th>
					<th>Mô tả</th>
                    
					<th>!</th>
				</tr>
                <?php
                while($row=mysql_fetch_array($result))
				{
				?>
				<tr class=success>
                    <td>1</td>
                    <td style="width: 350px;text-align: left !important;">
                        <a href="index.php?page=new&act=new_edit&id=<?php echo $row['id'];?>"><?php echo $row['tieude'];?></a>
                    </td>
                    <td><img src="../uploads/tintuc/<?php echo $row['anh'];?>" style="width:40px; height:40px"/></td>
                    <td><?php echo $row['mota'];?></td>
                    
                    <td style="font-size: 10px;width: 100px;"><a href="index.php?page=new&act=new_edit&id=<?php echo $row['id'];?>">Sửa</a>                    |
                        &nbsp;<a href="index.php?page=new&act=new_del&id=<?php echo $row['id'];?>" onclick="return confirmSubmit()">Xóa</a>                   </td>
				</tr>
                <?php 
				}
				?>
				</table>
			<!-- Start pagination -->
		<!-- /End of pagination -->
			<?php
				
			}	
    ?>
</div>
</div> <!-- End #tab1 -->

             

    </div> <!-- End .content-box-content -->
    
</div> <!-- End .content-box -->
<script LANGUAGE="JavaScript">
    function confirmSubmit()
    {
        var agree=confirm("Bạn có chắc chắn xóa không?");
        if (agree)
            return true ;
        else
            return false ;
    }
</script>